<template>
  <div id="app">
     <keep-alive exclude="PlayMusic">
    <router-view></router-view>
     </keep-alive>
    <!-- 播放器组件 -->
    <Player v-if="showPlayer" />
  </div>
</template>
<script  type='module'>
import Player from './views/Player/Player.vue' // 播放器组件
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState({
      showPlayer: state => (state.player.currentIndex >= 0)
    })
  },
  components: {
    Player // 播放器组件
  },
  created () {
    // 刷新时返回首页
    if (this.$router.path !== '/home') { this.$router.replace('/') }
  }
}
</script>
<style scoped lang="less">
#app {
  height: 100%;
}
</style>
